[VL][MINOR] Replace NULL with nullptr - #10958
Conversation
|
The original code is referenced from https://github.com/jemalloc/jemalloc/wiki/Use-Case%3A-Heap-Profiling. If |
|
@wForget Thanks ! I think https://github.com/jemalloc/jemalloc/wiki/Use-Case%3A-Heap-Profiling just give us an use case. |
|
Can we add it to the https://github.com/apache/incubator-gluten/blob/main/dev/format-cpp-code.sh? |
philo-he
left a comment
There was a problem hiding this comment.
Looks good. Just verified in my local build with enable_jemalloc_stats set to ON.
@FelixYBW, it seems clang-format doesn't support the check for using nullptr. @beliefer, could you add the following sentence in Constant section of CppCodingStyle.md to make developer aware of this convention?
Always use `nullptr` if you need a constant that represents a null pointer (`T*` for some `T`); use `0` otherwise for a zero value.
Reference:
https://github.com/facebookincubator/velox/blob/main/CODING_STYLE.md#constants
I mean to add a sed like |
|
@FelixYBW, I feel that using sed command may cause unintentional replacement issue. I just investigated Velox. It uses clang-tidy to check code style based on a configuration file, where we can set to replace NULL with nullptr, see https://github.com/facebookincubator/velox/blob/8a5a520fba06ab1fc10f124f3eb000bab886cd5d/.clang-tidy#L102. If this sounds good to you, I can help enable clang-tidy in another PR. It can also cover some other code styles checks. |
Thank you, @philo-he good idea. |
What changes are proposed in this pull request?
This PR proposes to replace
NULLwithnullptr.In C++,
nullptrshould always be used instead ofNULLbecause:Only consider using
NULLwhen maintaining very old code repositories or interacting with C interfaces that only acceptNULL.How was this patch tested?
GA tests.